#include <accelerometer.h>
#include <h01.h>
#include "power.h"
#include <rtc.h>

uint	curSteps;
uint	timer;
//uint	flashID;
ushort	error;
ushort	flags;
ubyte	clrSteps;
ubyte	lowPower;
ubyte	status;

DEBUG	debug;
REPORTS reports={RPT_VERSION,0x0002,
	RPT_TICKLO,0,	RPT_TICKHI,0,
	RPT_OFFSETLO,0,	RPT_OFFSETHI,0,
	RPT_VOLTB,0,	RPT_VOLTC,0,	RPT_VOLTS,VOLT_A,	
	RPT_TKCHGL,0,	RPT_TKCHGH,0,
	RPT_TCCHGC,0,	RPT_TCCHGV,0,
	RPT_CURRENTLO,0,RPT_CURRENTHI,0,
	RPT_YESTDAYLO,0,RPT_YESTDAYHI,0,
};
SAVE	savRam;

void main(void){
	while(1){
		switch(status){
		case STATUS_BOOTING:
			booting();
			break;
		case STATUS_CHARGING:
			charging();
			break;
		case STATUS_CLOCK:
			clock();
			break;
		case STATUS_PEDOMETER:
			pedometer();
			break;
		case STATUS_POWERDOWN:
			powerDown();
			break;
		case STATUS_SILENT:
		case STATUS_STANDBY:
			silent(status);
			break;
		default:
			status=getStatus();
		}
	}
}